package io.github.fb513.api.model;

import lombok.Getter;
import lombok.Setter;

@Setter
@Getter
public class CommonResp<T> {

    private final int code;
    private final String message;
    private T data;
    private PageInfo pageInfo;

    public CommonResp(int code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public void setTotalRecord(long totalRecord) {
        if (pageInfo != null) {
            pageInfo.setTotalRecord(totalRecord);
        }
    }
}
